import React from 'react';

import { connect } from 'react-redux';

import * as HomeAction from '../action'

import Search from '../components/Search'
import Wether from '../components/Wether'

import highSearch from '../../../components/HighSearch.js'

const HighSearch=highSearch(Search);

class HomeContainer extends React.Component {

    constructor(props) {
        super(props);
    }

    render() {
        return (
            <div>
                <HighSearch onSearch={(location)=>{this.load(location)}}/>
                <Wether {...this.props}/>
                {this.props.children}
            </div>
        )
    }

    load = (location)=>{
        const {fetchWetherData}=this.props;
        fetchWetherData(location);
    }

}

function mapStateToProps(state) {
    return { ...state.home }
}

export default connect(mapStateToProps,HomeAction)(HomeContainer)
